package cn.ht.jywrwater.module.ht.dal.mysql.villagemeter;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.villagemeter.VillageMeterDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.villagemeter.vo.*;

/**
 * 水表村庄绑定关系 Mapper
 *
 * @author hzx
 */
@Mapper
public interface VillageMeterMapper extends BaseMapperX<VillageMeterDO> {

    default PageResult<VillageMeterDO> selectPage(VillageMeterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VillageMeterDO>()
                .eqIfPresent(VillageMeterDO::getMeterCode, reqVO.getMeterCode())
                .eqIfPresent(VillageMeterDO::getVillageCode, reqVO.getVillageCode())
                .orderByDesc(VillageMeterDO::getId));
    }

    default List<VillageMeterDO> selectList(VillageMeterExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<VillageMeterDO>()
                .eqIfPresent(VillageMeterDO::getMeterCode, reqVO.getMeterCode())
                .eqIfPresent(VillageMeterDO::getVillageCode, reqVO.getVillageCode())
                .orderByDesc(VillageMeterDO::getId));
    }

}
